<?php
	/* Template Name: Product Category Page */ 
?>

<?php get_header() ?>

	<div id="container">
    
    	<?php include('breadcrumbs.php'); ?>
    
    	<?php get_sidebar() ?>
    
		<div id="content">

<?php the_post() ?>

			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
				<h2 class="entry-title"><?php the_title() ?></h2>
                <?php include ('socialbuttons.php'); ?>
				<div class="entry-content">
				<?php the_content() ?>

				</div>
                
                <!-- SPECIFIC PAGE INCLUDES - BELOW CONTENT -->
                <?php if(is_page(40) )  include 'includes-evactubes.php' ; ?>
                <?php if(is_page(56) )  include 'includes-flatplates.php' ; ?>
                <?php if(is_page(73) )  include 'includes-storagetanks.php' ; ?>
                <?php if(is_page(5513) )  include 'includes-resprepackagedkits.php' ; ?>
                <?php if(is_page(65) )  include 'pricelist-mountinghardware.php' ; ?>
                <?php if(is_page(100) ) include 'pricelist-lineset.php' ; ?>
                <?php if(is_page(120) ) include 'pricelist-controllers.php' ; ?>

		<?php // INCLUDE RELATED DOCUMENTS BY TAG
				$hastags = get_the_tags();
				if ( $hastags != '' ) {
					include 'page-include-document-tag-list.php' ;
				}
			?>
                
                
                <!-- SUB TITLES FOR CHILDREN PRODUCTS/CATEGORIES -->
				<?php if(is_page(40) )  echo '<h3>Additional Details About Our Evacuated Tube Collectors</h3>' ; ?>
                <?php if(is_page(56) )  echo '<h3>Additional Details About Our Flat Plate Collectors</h3>' ; ?>
                <?php if(is_page(73) )  echo '<h3>Additional Details About Solar Hot Water Storage Tanks</h3>' ; ?>
                <?php if(is_page(65) )  echo '<h3>Additional Details About Our ConnectMaxx Mounting Hardware</h3>' ; ?>
                <?php if(is_page(100) )  echo '<h3>Additional Details About Our FlowMaxx Line Set</h3>' ; ?>
                <?php if(is_page(120) )  echo '<h3>Additional Details About Our SmartMaxx Controllers</h3>' ; ?>
				
				<?php
$args = array(
'orderby' => 'menu_order', // Allows users to set order of subpages
'order' => 'ASC',
'numberposts' => '-1',
'post_parent' => $post->ID,
'post_type' => 'page',
'post_status' => 'publish'
); $postslist = get_posts($args);
foreach ($postslist as $post) : setup_postdata($post); ?>

						<div class="category-item">
                        	<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                        	<div class="product-thumb" style="float: left; margin-right: 10px; margin-bottom: 10px;">
								<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
                            </div>
                            <?php the_excerpt(); ?>
                            <p><a href="<?php the_permalink(); ?>">View This Product</a></p>
                            <div style="width: 660px; height: 1px; background-color: #cccccc; clear: both; margin-top: 10px; margin-bottom: 10px;"></div>
						</div>

					<? endforeach; ?>
                
			</div><!-- .post -->
            
            <!-- INCLUDE END OF PAGE CTA BLOCK IF THE PAGE HAS A CTA URL -->
            <?php if ( get_post_meta($post->ID, 'ctaURL', true) ) { ?>
				<?php include 'inpagecta.php'; ?>
			<?php } ?>

		</div><!-- #content -->
	</div><!-- #container -->

<?php get_footer() ?>